/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pfc.arbol;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;
import javax.swing.JSeparator;
import pfc.comun.IDEpfc;
import pfc.comun.Proyecto;
import pfc.gui.CGFormEdit;
import pfc.modelocg.CGForm;
import pfc.modelocg.CGModel;

/**
 *
 * @author xandru
 */
public class FormTreeNode extends PFCTreeNode implements ActionListener {
    private CGForm _cgForm;
    private CGModel _cgModel;

    public FormTreeNode(Proyecto p, String s) {
        super(p, s);
    }

    public void actionPerformed(ActionEvent e) {
        throw new UnsupportedOperationException("Not supported yet.");
    }


     protected void construirMenuContexto() {
        popupMenu = new JPopupMenu();

        JMenuItem mi = new JMenuItem("Propiedades");
        mi.setActionCommand("showProperties");
        //mi.addActionListener(this);


        mi.addActionListener(new java.awt.event.ActionListener() {
                                public void actionPerformed(java.awt.event.ActionEvent e) {
                                    showProperties();
            }

        });



        popupMenu.add(mi);
        mi.setEnabled(true);


        popupMenu.add(new JSeparator());

    }

    @Override
    public void showProperties() {
        System.out.println("Propiedades de " + this.getClass().getName());
        IDEpfc.logTime("Editando propiedades del formulario " + _cgForm.getName());
        CGFormEdit cgEdit = new CGFormEdit(this);
        IDEpfc.app.addParaEditar(cgEdit, _cgForm.getName());
    }

    void setCGFrom(CGForm fn) {
        this._cgForm = fn;
    }

    public CGForm getCGForm() {
        return this._cgForm;
    }

    public CGModel getCGModel() {
        return this._cgModel;
    }

    void setCGModel(CGModel cg) {
        this._cgModel = cg;
    }

    
}
